CXXFLAGS=-I/usr/include -Igenerated -I. -fPIC
LDFLAGS=-L/usr/lib -lIce -lIceUtil -lFreeze -lIceStorm -lIceGrid

all: libFIPAServer.so libMTSServer.so libAgentFactoryServer.so 

PersistentAgentServer: generated/PropertyType.o generated/PropertyService.o generated/ASDF.o generated/FIPATypes.o generated/FIPA.o generated/FIPAPersistent.o PersistentAgentServer.o PersistentAgentFactoryI.o PersistentAgentI.o 
PersistentAgentServer.o: generated/PropertyType.h generated/PropertyService.h generated/ASDF.h generated/FIPATypes.h generated/FIPA.h generated/FIPAPersistent.h PersistentAgentServer.cpp PersistentAgentFactoryI.h PersistentAgentI.h 

Client: generated/PropertyType.o generated/PropertyService.o generated/ASDF.o generated/FIPATypes.o generated/FIPA.o generated/PersistentFIPA.o Client.o 
Client.o: generated/PropertyType.h generated/PropertyService.h generated/ASDF.h generated/FIPATypes.h generated/FIPA.h generated/PersistentFIPA.h Client.cpp

libFIPAServer.so: generated/PropertyType.o generated/PropertyService.o generated/ASDF.o generated/FIPATypes.o generated/FIPA.o FIPAServer.o AMSI.o DFI.o
	gcc -fPIC -shared -o $@ -Wl,-soname,libFIPAServer.so.33 $^ -lIce -lIceUtil -lIceStorm
	/sbin/ldconfig -v -n .

libMTSServer.so: generated/PropertyType.o generated/PropertyService.o generated/ASDF.o generated/FIPATypes.o generated/FIPA.o MTSServer.o MTSI.o
	gcc -fPIC -shared -o $@ -Wl,-soname,libMTSServer.so.33 $^ -lIce -lIceUtil
	/sbin/ldconfig -v -n .

libAgentFactoryServer.so: generated/PropertyType.o generated/PropertyService.o generated/ASDF.o generated/FIPATypes.o generated/FIPA.o generated/Spammer.o AgentFactoryServer.o AgentFactoryI.o AgentI.o
	gcc -fPIC -shared -o $@ -Wl,-soname,libAgentFactoryServer.so.33 $^ -lIce -lIceUtil -lIceStorm -lIceGrid
	/sbin/ldconfig -v -n .

generated/%.h generated/%.cpp: ../../slice/%.ice
	slice2cpp --output-dir generated -I/usr/share/Ice/slice -I../../slice $<

generated/%.h generated/%.cpp: ../../test/%.ice
	slice2cpp --output-dir generated -I/usr/share/Ice/slice -I../../slice -I../../test $<

clean:
	rm -rf generated/* storage/*
	rm -rf *.o lib* PersistentAgentServer *~	
